<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/h_something/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/h_something/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/h_something/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/h_something/images/logo.svg" color="#222">

<link rel="stylesheet" href="/h_something/css/main.css">


<link rel="stylesheet" href="/h_something/lib/font-awesome/css/font-awesome.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"ddota2.gitee.io","root":"/h_something/","scheme":"Muse","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="获取脚本的目录 SHELL_FOLDER&#x3D;$(dirname $(readlink -f “$0”)) SHELL_FOLDER&#x3D;$(cd “$(dirname “$0”)”;pwd) 检测目录是否存在，不存在则创建if [ ! -d “$1” ];then mkdir $1fi  -f : 文件-d : 目录  nohup(包括但不限于) 中0,1,2意义：文件描述符: 0： 标准输入(std">
<meta property="og:type" content="article">
<meta property="og:title" content="shell_note">
<meta property="og:url" content="https://ddota2.gitee.io/2019/09/12/shell-note/index.html">
<meta property="og:site_name" content="D">
<meta property="og:description" content="获取脚本的目录 SHELL_FOLDER&#x3D;$(dirname $(readlink -f “$0”)) SHELL_FOLDER&#x3D;$(cd “$(dirname “$0”)”;pwd) 检测目录是否存在，不存在则创建if [ ! -d “$1” ];then mkdir $1fi  -f : 文件-d : 目录  nohup(包括但不限于) 中0,1,2意义：文件描述符: 0： 标准输入(std">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2019-09-12T10:28:57.000Z">
<meta property="article:modified_time" content="2020-11-19T08:41:15.396Z">
<meta property="article:author" content="Dota2 player">
<meta property="article:tag" content="linux">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://ddota2.gitee.io/2019/09/12/shell-note/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>shell_note | D</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/h_something/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">D</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">而已</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/h_something/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/h_something/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/h_something/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/h_something/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://ddota2.gitee.io/2019/09/12/shell-note/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/h_something/images/avatar.gif">
      <meta itemprop="name" content="Dota2 player">
      <meta itemprop="description" content="楼下的男人病的要死">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="D">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          shell_note
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2019-09-12 18:28:57" itemprop="dateCreated datePublished" datetime="2019-09-12T18:28:57+08:00">2019-09-12</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-11-19 16:41:15" itemprop="dateModified" datetime="2020-11-19T16:41:15+08:00">2020-11-19</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/h_something/categories/linux/" itemprop="url" rel="index"><span itemprop="name">linux</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <ol>
<li>获取脚本的目录<br> SHELL_FOLDER=$(dirname $(readlink -f “$0”))<br> SHELL_FOLDER=$(cd “$(dirname “$0”)”;pwd)</li>
<li>检测目录是否存在，不存在则创建<br>if [ ! -d “$1” ];then<br> mkdir $1<br>fi</li>
</ol>
<p>-f : 文件<br>-d : 目录</p>
<ol start="3">
<li>nohup(包括但不限于) 中0,1,2意义：<br>文件描述符:<br> 0： 标准输入(stdin)<br> 1： 标准输出(stdout)<br> 2： 标准错误输出(stderr)<br> command &gt; file    将输出重定向到 file。<br> command &lt; file    将输入重定向到 file。<br> command &gt;&gt; file    将输出以追加的方式重定向到 file。<br> n &gt; file    将文件描述符为 n 的文件重定向到 file。<br> n &gt;&gt; file    将文件描述符为 n 的文件以追加的方式重定向到 file。<br> n &gt;&amp; m    将输出文件 m 和 n 合并。<br> n &lt;&amp; m    将输入文件 m 和 n 合并。<br> &lt;&lt; tag    将开始标记 tag 和结束标记 tag 之间的内容作为输入。</li>
</ol>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/h_something/tags/linux/" rel="tag"># linux</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item"></div>
      <div class="post-nav-item">
    <a href="/h_something/2019/12/06/windows-problem-1/" rel="next" title="windows_problem_1">
      windows_problem_1 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">Dota2 player</p>
  <div class="site-description" itemprop="description">楼下的男人病的要死</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/h_something/archives/">
        
          <span class="site-state-item-count">11</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/h_something/categories/">
          
        <span class="site-state-item-count">5</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/h_something/tags/">
          
        <span class="site-state-item-count">15</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Dota2 player</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://muse.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a> 强力驱动
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/h_something/lib/anime.min.js"></script>
  <script src="/h_something/lib/velocity/velocity.min.js"></script>
  <script src="/h_something/lib/velocity/velocity.ui.min.js"></script>

<script src="/h_something/js/utils.js"></script>

<script src="/h_something/js/motion.js"></script>


<script src="/h_something/js/schemes/muse.js"></script>


<script src="/h_something/js/next-boot.js"></script>




  















  

  

</body>
</html>
